

#ifndef EMPLOYEEAO_STRUCT_H
#define EMPLOYEEAO_STRUCT_H

#include <stdint.h>
#include <string>
#include <iostream>
#include "libc2c/byte_stream.h"
#include "app_platform/intf_service_object.h"
#include "erp/employee/po/employeepo_employee.h"	
#include "erp/employee/po/employeefilterpo_employee.h"	
#include <set>	
#include <map>	

namespace erp
{
namespace employee
{
namespace ao
{

	const uint32_t EMPLOYEEAO_ADDEMPLOYEE_REQ_CMD_ID = 0xC0011802; /// 请求命令号
	const uint32_t EMPLOYEEAO_ADDEMPLOYEE_RESP_CMD_ID = 0xC0018802; /// 回应命令号
	

	const uint32_t EMPLOYEEAO_GETEMPLOYEEBYID_REQ_CMD_ID = 0xC0011801; /// 请求命令号
	const uint32_t EMPLOYEEAO_GETEMPLOYEEBYID_RESP_CMD_ID = 0xC0018801; /// 回应命令号
	


const uint16_t EMPLOYEEAO_MAX_PROTOCAL_VERSION = 2; //>平台支持的最大协议版本号


///////////////////////////// STRUCTS /////////////////////////////////////////////////
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-18 14:07:59
 	 * @version 0
	 */	
	struct CEmployeeAoAddEmployeeReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		erp::employee::po::CEmployeePo employee;	
		std::string inReserve;
		std::string errmsg;
		erp::employee::po::CEmployeePo employeeBack;	
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return EMPLOYEEAO_ADDEMPLOYEE_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > EMPLOYEEAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			employee.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-18 14:07:59
 	 * @version 0
	 */	
	struct CEmployeeAoAddEmployeeResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		erp::employee::po::CEmployeePo employeeBack;	
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return EMPLOYEEAO_ADDEMPLOYEE_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			employeeBack.Serialize(bs);
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-18 14:07:59
 	 * @version 0
	 */	
	struct CEmployeeAoGetEmployeeByIdReq : public IServiceObject, public ISerializableXML
	{
		std::string machineKey;
		std::string source;
		uint32_t sceneId;
		erp::employee::po::CEmployeeFilterPo employeeFilter;	
		std::string inReserve;
		std::string errmsg;
		std::map<uint32_t,erp::employee::po::CEmployeePo > employees;
		std::string outReserve;
	
	    virtual uint32_t getCmdId() const { return EMPLOYEEAO_GETEMPLOYEEBYID_REQ_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
			//检查协议的版本号
		    //if(bs.getVersion() > EMPLOYEEAO_MAX_PROTOCAL_VERSION)
		    //    return false;
			bs & machineKey;
			bs & source;
			bs & sceneId;
			employeeFilter.Serialize(bs);
			bs & inReserve;
		    return bs.isGood();
		}
		
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};
	
	/**
	 *
 	 * 
	 *
 	 * @date 2013-10-18 14:07:59
 	 * @version 0
	 */	
	struct CEmployeeAoGetEmployeeByIdResp : public IServiceObject, public ISerializableXML
	{
		uint32_t dwResult;
		std::string errmsg;
		std::map<uint32_t,erp::employee::po::CEmployeePo > employees;
		std::string outReserve;
		
	    virtual uint32_t getCmdId() const { return EMPLOYEEAO_GETEMPLOYEEBYID_RESP_CMD_ID; }
		virtual bool Serialize(CByteStreamNetwork& bs)
		{
		    bs & dwResult;
			bs & errmsg;
			bs & employees;
			bs & outReserve;

		    return bs.isGood();
		}
	    virtual void Dump(std::ostream& os)	{}
	
		virtual bool FromXML(const std::string& sXMLContent) { return true; }
		virtual bool ToXML(std::string& sXMLContent) { return true; }
	};	

}
}
}

#endif /* EMPLOYEEAO_STRUCT_H */

